import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

/**
 * @author 美国五星上将麦克阿瑟
 */
public class Elbowing extends JFrame {

    public Elbowing(){
        setTitle("警告！");
        setSize(200,200);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

        addWindowListener(new WindowListener() {
            @Override
            public void windowOpened(WindowEvent e) {

            }

            @Override
            public void windowClosing(WindowEvent e) {
                setVisible(false);
            }

            @Override
            public void windowClosed(WindowEvent e) {

            }

            @Override
            public void windowIconified(WindowEvent e) {

            }

            @Override
            public void windowDeiconified(WindowEvent e) {

            }

            @Override
            public void windowActivated(WindowEvent e) {

            }

            @Override
            public void windowDeactivated(WindowEvent e) {

            }
        });

        JPanel panel = init();

        Container contentPane = getContentPane();
        contentPane.add(panel);

        panel.setVisible(true);

        setVisible(true);
    }

    JPanel init(){
        JPanel panel = new JPanel(new FlowLayout());

        JLabel label = new JLabel("你被肘了！");

        label.setFont(InitFont.initFont());

        panel.add(label);

        return panel;
    }

}
